package com.gitee.wsl.mathematics.geometry.d2.circle

import com.gitee.wsl.mathematics.coordinate.d2.Coordinate2
import com.gitee.wsl.mathematics.geometry.d2.Segment2d
import com.gitee.wsl.mathematics.number.compareTo
import com.gitee.wsl.mathematics.vector.ext.minus
import com.gitee.wsl.unit.angle.AngleUnit


interface WyeShape2d<N:Number,V: Coordinate2<N, V>>:CircleShape2d<N,V>, Segment2d<N, V, CircleShape2d<N, V>> {

    override fun containsPoint(p: Coordinate2<N, *>): Boolean = (p - center).length <= abs(radius-outerRadius)

    override var radius: N
        get() = parent.radius
        set(value) {
            parent.radius = value
        }

    val innerRadius get() = parent.radius

    val outerRadius:N

    val outerCircle get() = create(center,outerRadius)

    override val area: N
        get() = outerCircle.area - super.area

    fun create(p:V, radius:N,outerRadius:N):WyeShape2d<N,V>

    override fun createSegment(startAngle: AngleUnit, sweepAngle: AngleUnit):SliceSegment2d<N,V,*>

    override fun getPointOnAngle(angle: AngleUnit) = parent.getPointOnAngle(angle)


}